package com.fxnotes.common;

import com.fxnotes.common.ui.components.ModalDialogBuilder;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.control.TextFieldBuilder;
import javafx.scene.control.Tooltip;
import javafx.stage.Window;

public class FxUtils {
    
    public static final int INVALID_LIST_INDEX = -1;
      
    public static TextField createNameField(String initialText) {
        return TextFieldBuilder.create()
                .text(initialText)
                .prefWidth(250)
                .build();
    }
    
    public static Tooltip createTooltip(String text) {
        return new Tooltip(text);
    }
    
    public static void displayError(Window owner, String message) {
        ModalDialogBuilder.create()
            .owner(owner)
            .title("Error")
            .width(250)
            .content(new Label(message))
            .cancelButton("Close")
            .build()
            .show();   
    }    
}
